home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 19 / Mac Magazin and MacEasy Magazine CD - Issue 19.iso / Grafik & Text & Film / Quark XTensions / Freeware Xtensions / Quark AppleScript Scripts / Scripts (text only) / Update to Current Version < prev   
Text File  |  1994-05-02  |  2KB  |  66 lines

  1. --Copyright 1994 Quark, Inc.   All rights reserved.
  2.  
  3.  
  4. global fileName
  5. property dfn : ""
  6.  
  7. on pathName(fileAlias)
  8.     copy fileAlias as string to xx
  9.     copy text item delimiters of AppleScript to savedDelim
  10.     set text item delimiters of AppleScript to {":"}
  11.     set fileName to last text item of xx as string
  12.     set text item delimiters of AppleScript to savedDelim
  13. end pathName
  14.  
  15. on open y
  16.     set b to button returned of (display dialog ¬
  17.         "             Update QuarkXPress™ Document
  18.                              to Current Version
  19.                                  
  20. Update existing documents to current version or retain backups and save new documents?" buttons {"Cancel", "Update", "Save New"} default button 3)
  21.     if b = "Save New" then
  22.         set destpath to (choose folder with prompt "Select a destination folder for new documents.") as text
  23.     end if
  24.     set x to 1
  25.     repeat number of items in y times
  26.         set docpath to item x of y
  27.         set z to info for item x of y
  28.         if z is not folder then
  29.             if z's file type is not "XDOC" then
  30.                 beep 2
  31.             else
  32.                 tell application "QuarkXPress™"
  33.                     open item x of y use doc prefs yes
  34.                     tell document 1
  35.                         make text box at beginning
  36.                         tell text box 1
  37.                             set name to "Marc Grabowski's Box"
  38.                             set bounds to {"3 pt", "3 pt", "13 pt", "13 pt"}
  39.                         end tell
  40.                         delete text box "Marc Grabowski's Box"
  41.                         if b = "Save New" then
  42.                             my pathName(docpath)
  43.                             try
  44.                                 save in (destpath & fileName)
  45.                             on error number -47
  46.                                 if dfn = "Replace" then
  47.                                     save
  48.                                 else
  49.                                     set dfn to button returned of (display dialog "The original file(s) currently exist(s) in this location.  Do you want to replace the original document(s)?" buttons {"Replace", "Cancel"} default button 2 with icon caution)
  50.                                     if dfn = "Replace" then save
  51.                                 end if
  52.                             end try
  53.                             close
  54.                         else if b = "Update" then
  55.                             save
  56.                             close
  57.                         end if
  58.                     end tell
  59.                 end tell
  60.             end if
  61.             set x to x + 1
  62.         else
  63.             beep 1
  64.         end if
  65.     end repeat
  66. end open